import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '货位号',
    align:"center",
    dataIndex: 'cargoNo'
   },
   {
    title: '行坐标',
    align:"center",
    dataIndex: 'posiX'
   },
   {
    title: '列坐标',
    align:"center",
    dataIndex: 'posiY'
   },
   {
    title: '层坐标',
    align:"center",
    dataIndex: 'posiZ'
   },
   {
    title: '货位宽',
    align:"center",
    dataIndex: 'cargoWidth'
   },
   {
    title: '货位深',
    align:"center",
    dataIndex: 'cargoDeep'
   },
   {
    title: '货位高',
    align:"center",
    dataIndex: 'cargoHight'
   },
   {
    title: '托盘号',
    align:"center",
    dataIndex: 'palletNo'
   },
   {
    title: '库区编号',
    align:"center",
    dataIndex: 'areaNo'
   },
   {
    title: '仓库编号',
    align:"center",
    dataIndex: 'warehouseNo'
   },
   {
    title: '巷道编号',
    align:"center",
    dataIndex: 'roadNo'
   },
   {
    title: '巷道序',
    align:"center",
    dataIndex: 'roadLine'
   },
   {
    title: '货位状态',
    align:"center",
    dataIndex: 'cargoLocationStatus_dictText'
   },
   {
    title: '货位类型',
    align:"center",
    dataIndex: 'cargoType'
   },
   {
    title: '创建人',
    align:"center",
    dataIndex: 'createBy'
   },
   {
    title: '创建时间',
    align:"center",
    sorter: true,
    dataIndex: 'createTime'
   },
   {
    title: '更新人',
    align:"center",
    dataIndex: 'updateBy'
   },
   {
    title: '更新时间',
    align:"center",
    sorter: true,
    dataIndex: 'updateTime'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "货位号",
      field: 'cargoNo',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "行坐标",
      field: 'posiX',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "列坐标",
      field: 'posiY',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "层坐标",
      field: 'posiZ',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "货位宽",
      field: 'cargoWidth',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "货位深",
      field: 'cargoDeep',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "货位高",
      field: 'cargoHight',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "托盘号",
      field: 'palletNo',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "库区编号",
      field: 'areaNo',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "仓库编号",
      field: 'warehouseNo',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "巷道编号",
      field: 'roadNo',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "巷道序",
      field: 'roadLine',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "货位状态",
      field: 'cargoLocationStatus',
      component: 'JDictSelectTag',
      componentProps:{
      },
      //colProps: {span: 6},
 	},
	{
      label: "货位类型",
      field: 'cargoType',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "创建人",
      field: 'createBy',
      component: 'Input',
      //colProps: {span: 6},
 	},
     {
      label: "创建时间",
      field: "createTime",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
          showTime:true
      },
      //colProps: {span: 6},
	},
	{
      label: "更新人",
      field: 'updateBy',
      component: 'Input',
      //colProps: {span: 6},
 	},
     {
      label: "更新时间",
      field: "updateTime",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
          showTime:true
      },
      //colProps: {span: 6},
	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '货位号',
    field: 'cargoNo',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入货位号!'},
          ];
     },
  },
  {
    label: '行坐标',
    field: 'posiX',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入行坐标!'},
                 { pattern: /^-?\d+$/, message: '请输入整数!'},
          ];
     },
  },
  {
    label: '列坐标',
    field: 'posiY',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入列坐标!'},
                 { pattern: /^-?\d+$/, message: '请输入整数!'},
          ];
     },
  },
  {
    label: '层坐标',
    field: 'posiZ',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入层坐标!'},
                 { pattern: /^-?\d+$/, message: '请输入整数!'},
          ];
     },
  },
  {
    label: '货位宽',
    field: 'cargoWidth',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入货位宽!'},
                 { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'},
          ];
     },
  },
  {
    label: '货位深',
    field: 'cargoDeep',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入货位深!'},
                 { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'},
          ];
     },
  },
  {
    label: '货位高',
    field: 'cargoHight',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入货位高!'},
                 { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'},
          ];
     },
  },
  {
    label: '托盘号',
    field: 'palletNo',
    component: 'Input',
  },
  {
    label: '库区编号',
    field: 'areaNo',
    component: 'Input',
  },
  {
    label: '仓库编号',
    field: 'warehouseNo',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入仓库编号!'},
          ];
     },
  },
  {
    label: '巷道编号',
    field: 'roadNo',
    component: 'InputNumber',
  },
  {
    label: '巷道序',
    field: 'roadLine',
    component: 'InputNumber',
  },
  {
    label: '货位状态',
    field: 'cargoLocationStatus',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:""
     },
  },
  {
    label: '货位类型',
    field: 'cargoType',
    component: 'InputNumber',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  cargoNo: {title: '货位号',order: 0,view: 'text', type: 'string',},
  posiX: {title: '行坐标',order: 1,view: 'number', type: 'number',},
  posiY: {title: '列坐标',order: 2,view: 'number', type: 'number',},
  posiZ: {title: '层坐标',order: 3,view: 'number', type: 'number',},
  cargoWidth: {title: '货位宽',order: 4,view: 'number', type: 'number',},
  cargoDeep: {title: '货位深',order: 5,view: 'number', type: 'number',},
  cargoHight: {title: '货位高',order: 6,view: 'number', type: 'number',},
  palletNo: {title: '托盘号',order: 7,view: 'text', type: 'string',},
  areaNo: {title: '库区编号',order: 8,view: 'text', type: 'string',},
  warehouseNo: {title: '仓库编号',order: 9,view: 'text', type: 'string',},
  roadNo: {title: '巷道编号',order: 10,view: 'number', type: 'number',},
  roadLine: {title: '巷道序',order: 11,view: 'number', type: 'number',},
  cargoLocationStatus: {title: '货位状态',order: 12,view: 'number', type: 'number',},
  cargoType: {title: '货位类型',order: 13,view: 'number', type: 'number',},
  createBy: {title: '创建人',order: 14,view: 'text', type: 'string',},
  createTime: {title: '创建时间',order: 15,view: 'datetime', type: 'string',},
  updateBy: {title: '更新人',order: 16,view: 'text', type: 'string',},
  updateTime: {title: '更新时间',order: 17,view: 'datetime', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
